import Vue from 'vue'
import * as timeUtils from './timeUtils'

// 时间戳转字符串
export const tamp2Str = Vue.filter('tamp2Str', function(timetamp) {
    return timeUtils.time2String(timetamp, true, false)
})

// 填充链接的url
export const fillhttp = Vue.filter('fillhttp', function(url) {
    if (!url) return url
    let apiUrl = 'http://'
    return url.indexOf('://') > -1 ? url : apiUrl + url
})

export const stepType = Vue.filter('stepType', (val, type) => {
    let map = {
        0: {
            label: '发起申请',
            tag: 'info'
        },
        1: {
            label: '审核中',
            tag: 'warning'
        },
        2: {
            label: '已同意',
            tag: 'success'
        },
        3: {
            label: '已拒绝',
            tag: 'danger'
        }
    }
    return map[val][type]
})